/* 
需求1
*/
function maxIndex(arr = []) { 
    let max = 0,index
    for (let i = 0;i < arr.length;i++) {
        if (arr[i] > max) {
            max = arr[i]
            index = i
        }
    }
    return index
}
/* 
需求2
*/
function getArr(num) {
    let arr = []
    for (let i = 0;i < num;i++) {
       arr.push(parseInt(Math.random()*100)+1)
    }
    return arr
}
/* 
需求3
*/
function maxNum(a, b) {
    let obj = {
        num1: a,
        num2: b
    }
    let arr = [0,obj]
    a>b?arr[0] = a:arr[0] = b
    return arr
}
/* 
需求4
*/
function string(str = '') {
    return str.substring(str.length-2,str.length-1)
}
console.log(string(`abcdefg`));